{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[Getting data:]#############总成交股数\n",
      "大于100手的总和 2150\n",
      "大单占比 0.326648435126\n"
     ]
    }
   ],
   "source": [
    "import tushare as ts\n",
    "import os\n",
    "df = ts.get_today_ticks('300104')\n",
    "total_vol=df['volume'].sum()*100\n",
    "print(u'总成交股数'\n",)
    "big_deal=df[df['volume']>=100]['volume'].sum()\n",
    "print(u'大于100手的总和',big_deal\n",)
    "percent=float(big_deal)/total_vol*100\n",
    "print(u'大单占比',percent")
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "大于100手的总和 215000\n"
     ]
    }
   ],
   "source": [
    "big_deal=df[df['volume']>=100]['volume'].sum()*100\n",
    "print(u'大于100手的总和',big_deal")
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "32.6648435126\n"
     ]
    }
   ],
   "source": [
    "percent=float(big_deal)/total_vol*100\n",
    "print(percent")
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>time</th>\n",
       "      <th>price</th>\n",
       "      <th>pchange</th>\n",
       "      <th>change</th>\n",
       "      <th>volume</th>\n",
       "      <th>amount</th>\n",
       "      <th>type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>758</th>\n",
       "      <td>09:25:03</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>937</td>\n",
       "      <td>942622</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>756</th>\n",
       "      <td>09:30:06</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>217</td>\n",
       "      <td>218302</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>675</th>\n",
       "      <td>09:37:45</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>206</td>\n",
       "      <td>207236</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>563</th>\n",
       "      <td>09:50:21</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>200</td>\n",
       "      <td>201200</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>338</th>\n",
       "      <td>10:47:00</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>146</td>\n",
       "      <td>146876</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>14:50:27</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>125</td>\n",
       "      <td>125750</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>757</th>\n",
       "      <td>09:30:03</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>118</td>\n",
       "      <td>118708</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>51</th>\n",
       "      <td>14:38:12</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>101</td>\n",
       "      <td>101606</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>136</th>\n",
       "      <td>13:59:06</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>100</td>\n",
       "      <td>100600</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>747</th>\n",
       "      <td>09:30:42</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>98</td>\n",
       "      <td>98588</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>15:00:03</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>96</td>\n",
       "      <td>96576</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>177</th>\n",
       "      <td>13:40:06</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>91</td>\n",
       "      <td>91546</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>755</th>\n",
       "      <td>09:30:09</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>89</td>\n",
       "      <td>89534</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>357</th>\n",
       "      <td>10:40:06</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>81</td>\n",
       "      <td>81486</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>356</th>\n",
       "      <td>10:40:06</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>81</td>\n",
       "      <td>81486</td>\n",
       "      <td>中性盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>743</th>\n",
       "      <td>09:31:03</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>68</td>\n",
       "      <td>68408</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>636</th>\n",
       "      <td>09:40:36</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>57</td>\n",
       "      <td>57342</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>622</th>\n",
       "      <td>09:42:27</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>54</td>\n",
       "      <td>54324</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>372</th>\n",
       "      <td>10:34:39</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>50</td>\n",
       "      <td>50300</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>754</th>\n",
       "      <td>09:30:12</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>48</td>\n",
       "      <td>48288</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>710</th>\n",
       "      <td>09:34:33</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>48</td>\n",
       "      <td>48288</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>666</th>\n",
       "      <td>09:38:15</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>41</td>\n",
       "      <td>41246</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>254</th>\n",
       "      <td>13:00:06</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>41</td>\n",
       "      <td>41246</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>673</th>\n",
       "      <td>09:37:54</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>38</td>\n",
       "      <td>38228</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>662</th>\n",
       "      <td>09:38:39</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>35</td>\n",
       "      <td>35210</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>694</th>\n",
       "      <td>09:36:12</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>34</td>\n",
       "      <td>34204</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>362</th>\n",
       "      <td>10:38:48</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>34</td>\n",
       "      <td>34204</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>619</th>\n",
       "      <td>09:43:18</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>32</td>\n",
       "      <td>32192</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75</th>\n",
       "      <td>14:27:03</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>32</td>\n",
       "      <td>32192</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>684</th>\n",
       "      <td>09:37:00</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>31</td>\n",
       "      <td>31186</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>448</th>\n",
       "      <td>10:14:30</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>446</th>\n",
       "      <td>10:14:57</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>444</th>\n",
       "      <td>10:15:39</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>443</th>\n",
       "      <td>10:15:54</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>442</th>\n",
       "      <td>10:16:00</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>438</th>\n",
       "      <td>10:16:27</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>466</th>\n",
       "      <td>10:10:24</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>250</th>\n",
       "      <td>13:01:48</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>472</th>\n",
       "      <td>10:09:03</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>487</th>\n",
       "      <td>10:04:48</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>237</th>\n",
       "      <td>13:06:03</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>239</th>\n",
       "      <td>13:04:51</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>494</th>\n",
       "      <td>10:02:51</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>241</th>\n",
       "      <td>13:04:27</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>242</th>\n",
       "      <td>13:04:21</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>490</th>\n",
       "      <td>10:03:45</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>243</th>\n",
       "      <td>13:04:00</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>474</th>\n",
       "      <td>10:08:00</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>244</th>\n",
       "      <td>13:03:54</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>245</th>\n",
       "      <td>13:03:48</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>483</th>\n",
       "      <td>10:06:18</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>91</th>\n",
       "      <td>14:18:30</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>481</th>\n",
       "      <td>10:06:57</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>480</th>\n",
       "      <td>10:07:09</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>92</th>\n",
       "      <td>14:18:09</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>478</th>\n",
       "      <td>10:07:18</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>248</th>\n",
       "      <td>13:03:27</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>14:54:51</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>14:57:03</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>256</th>\n",
       "      <td>11:30:03</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>买盘</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>759 rows × 7 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         time  price pchange  change  volume  amount type\n",
       "758  09:25:03  10.06  -10.02       0     937  942622    0\n",
       "756  09:30:06  10.06  -10.02       0     217  218302   买盘\n",
       "675  09:37:45  10.06  -10.02       0     206  207236   买盘\n",
       "563  09:50:21  10.06  -10.02       0     200  201200   买盘\n",
       "338  10:47:00  10.06  -10.02       0     146  146876   买盘\n",
       "26   14:50:27  10.06  -10.02       0     125  125750   买盘\n",
       "757  09:30:03  10.06  -10.02       0     118  118708   买盘\n",
       "51   14:38:12  10.06  -10.02       0     101  101606   买盘\n",
       "136  13:59:06  10.06  -10.02       0     100  100600   买盘\n",
       "747  09:30:42  10.06  -10.02       0      98   98588   买盘\n",
       "0    15:00:03  10.06  -10.02       0      96   96576   买盘\n",
       "177  13:40:06  10.06  -10.02       0      91   91546   买盘\n",
       "755  09:30:09  10.06  -10.02       0      89   89534   买盘\n",
       "357  10:40:06  10.06  -10.02       0      81   81486   买盘\n",
       "356  10:40:06  10.06  -10.02       0      81   81486  中性盘\n",
       "743  09:31:03  10.06  -10.02       0      68   68408   买盘\n",
       "636  09:40:36  10.06  -10.02       0      57   57342   买盘\n",
       "622  09:42:27  10.06  -10.02       0      54   54324   买盘\n",
       "372  10:34:39  10.06  -10.02       0      50   50300   买盘\n",
       "754  09:30:12  10.06  -10.02       0      48   48288   买盘\n",
       "710  09:34:33  10.06  -10.02       0      48   48288   买盘\n",
       "666  09:38:15  10.06  -10.02       0      41   41246   买盘\n",
       "254  13:00:06  10.06  -10.02       0      41   41246   买盘\n",
       "673  09:37:54  10.06  -10.02       0      38   38228   买盘\n",
       "662  09:38:39  10.06  -10.02       0      35   35210   买盘\n",
       "694  09:36:12  10.06  -10.02       0      34   34204   买盘\n",
       "362  10:38:48  10.06  -10.02       0      34   34204   买盘\n",
       "619  09:43:18  10.06  -10.02       0      32   32192   买盘\n",
       "75   14:27:03  10.06  -10.02       0      32   32192   买盘\n",
       "684  09:37:00  10.06  -10.02       0      31   31186   买盘\n",
       "..        ...    ...     ...     ...     ...     ...  ...\n",
       "448  10:14:30  10.06  -10.02       0       1    1006   买盘\n",
       "446  10:14:57  10.06  -10.02       0       1    1006   买盘\n",
       "444  10:15:39  10.06  -10.02       0       1    1006   买盘\n",
       "443  10:15:54  10.06  -10.02       0       1    1006   买盘\n",
       "442  10:16:00  10.06  -10.02       0       1    1006   买盘\n",
       "438  10:16:27  10.06  -10.02       0       1    1006   买盘\n",
       "466  10:10:24  10.06  -10.02       0       1    1006   买盘\n",
       "250  13:01:48  10.06  -10.02       0       1    1006   买盘\n",
       "472  10:09:03  10.06  -10.02       0       1    1006   买盘\n",
       "487  10:04:48  10.06  -10.02       0       1    1006   买盘\n",
       "237  13:06:03  10.06  -10.02       0       1    1006   买盘\n",
       "239  13:04:51  10.06  -10.02       0       1    1006   买盘\n",
       "494  10:02:51  10.06  -10.02       0       1    1006   买盘\n",
       "241  13:04:27  10.06  -10.02       0       1    1006   买盘\n",
       "242  13:04:21  10.06  -10.02       0       1    1006   买盘\n",
       "490  10:03:45  10.06  -10.02       0       1    1006   买盘\n",
       "243  13:04:00  10.06  -10.02       0       1    1006   买盘\n",
       "474  10:08:00  10.06  -10.02       0       1    1006   买盘\n",
       "244  13:03:54  10.06  -10.02       0       1    1006   买盘\n",
       "245  13:03:48  10.06  -10.02       0       1    1006   买盘\n",
       "483  10:06:18  10.06  -10.02       0       1    1006   买盘\n",
       "91   14:18:30  10.06  -10.02       0       1    1006   买盘\n",
       "481  10:06:57  10.06  -10.02       0       1    1006   买盘\n",
       "480  10:07:09  10.06  -10.02       0       1    1006   买盘\n",
       "92   14:18:09  10.06  -10.02       0       1    1006   买盘\n",
       "478  10:07:18  10.06  -10.02       0       1    1006   买盘\n",
       "248  13:03:27  10.06  -10.02       0       1    1006   买盘\n",
       "11   14:54:51  10.06  -10.02       0       1    1006   买盘\n",
       "1    14:57:03  10.06  -10.02       0       0       0   买盘\n",
       "256  11:30:03  10.06  -10.02       0       0       0   买盘\n",
       "\n",
       "[759 rows x 7 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.sort_values('volume',ascending=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>time</th>\n",
       "      <th>price</th>\n",
       "      <th>pchange</th>\n",
       "      <th>change</th>\n",
       "      <th>volume</th>\n",
       "      <th>amount</th>\n",
       "      <th>type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>14:41:09</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>12</td>\n",
       "      <td>12072</td>\n",
       "      <td>中性盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>85</th>\n",
       "      <td>14:20:15</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>9</td>\n",
       "      <td>9054</td>\n",
       "      <td>中性盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>124</th>\n",
       "      <td>14:03:15</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>3018</td>\n",
       "      <td>中性盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>167</th>\n",
       "      <td>13:44:24</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>中性盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>201</th>\n",
       "      <td>13:24:06</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>中性盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>233</th>\n",
       "      <td>13:06:57</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>中性盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>271</th>\n",
       "      <td>11:17:51</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>中性盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>308</th>\n",
       "      <td>10:58:21</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2012</td>\n",
       "      <td>中性盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>356</th>\n",
       "      <td>10:40:06</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>81</td>\n",
       "      <td>81486</td>\n",
       "      <td>中性盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>422</th>\n",
       "      <td>10:21:12</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1006</td>\n",
       "      <td>中性盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>495</th>\n",
       "      <td>10:02:39</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>6</td>\n",
       "      <td>6036</td>\n",
       "      <td>中性盘</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>613</th>\n",
       "      <td>09:43:39</td>\n",
       "      <td>10.06</td>\n",
       "      <td>-10.02</td>\n",
       "      <td>0</td>\n",
       "      <td>8</td>\n",
       "      <td>8048</td>\n",
       "      <td>中性盘</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         time  price pchange  change  volume  amount type\n",
       "45   14:41:09  10.06  -10.02       0      12   12072  中性盘\n",
       "85   14:20:15  10.06  -10.02       0       9    9054  中性盘\n",
       "124  14:03:15  10.06  -10.02       0       3    3018  中性盘\n",
       "167  13:44:24  10.06  -10.02       0       1    1006  中性盘\n",
       "201  13:24:06  10.06  -10.02       0       1    1006  中性盘\n",
       "233  13:06:57  10.06  -10.02       0       1    1006  中性盘\n",
       "271  11:17:51  10.06  -10.02       0       1    1006  中性盘\n",
       "308  10:58:21  10.06  -10.02       0       2    2012  中性盘\n",
       "356  10:40:06  10.06  -10.02       0      81   81486  中性盘\n",
       "422  10:21:12  10.06  -10.02       0       1    1006  中性盘\n",
       "495  10:02:39  10.06  -10.02       0       6    6036  中性盘\n",
       "613  09:43:39  10.06  -10.02       0       8    8048  中性盘"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[df['type']==u'中性盘']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1      299\n",
       "2       98\n",
       "10      71\n",
       "3       64\n",
       "5       47\n",
       "4       30\n",
       "6       20\n",
       "8       17\n",
       "9       13\n",
       "11      11\n",
       "20       9\n",
       "7        6\n",
       "12       6\n",
       "14       5\n",
       "30       5\n",
       "13       4\n",
       "15       4\n",
       "18       3\n",
       "21       3\n",
       "16       2\n",
       "17       2\n",
       "32       2\n",
       "28       2\n",
       "0        2\n",
       "81       2\n",
       "41       2\n",
       "48       2\n",
       "34       2\n",
       "31       1\n",
       "206      1\n",
       "200      1\n",
       "146      1\n",
       "125      1\n",
       "118      1\n",
       "101      1\n",
       "100      1\n",
       "98       1\n",
       "96       1\n",
       "91       1\n",
       "89       1\n",
       "57       1\n",
       "68       1\n",
       "54       1\n",
       "50       1\n",
       "19       1\n",
       "38       1\n",
       "35       1\n",
       "22       1\n",
       "23       1\n",
       "24       1\n",
       "25       1\n",
       "217      1\n",
       "29       1\n",
       "937      1\n",
       "Name: volume, dtype: int64"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['volume'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "small_deal=df[df['volume']<10]['volume'].sum()*100"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "145700"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "small_deal"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2.0"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['volume'].median()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([   1.,    2.,    8.,  937.])"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from scipy import stats\n",
    "stats.scoreatpercentile(df['volume'],[25,50,75,100])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0      -3.257\n",
       "1      -0.802\n",
       "2      -1.224\n",
       "3       0.000\n",
       "4       0.514\n",
       "5      -1.086\n",
       "6      -2.472\n",
       "7       0.405\n",
       "8      -1.762\n",
       "9      -1.067\n",
       "10      0.000\n",
       "11     -3.340\n",
       "12     -2.318\n",
       "13      0.838\n",
       "14      1.137\n",
       "15     -1.505\n",
       "16     -1.403\n",
       "17      1.354\n",
       "18     -2.817\n",
       "19     -1.615\n",
       "20     -2.445\n",
       "21     -1.766\n",
       "22      0.288\n",
       "23     -0.834\n",
       "24     -1.614\n",
       "25     -1.638\n",
       "26     -4.480\n",
       "27     -2.630\n",
       "28      1.794\n",
       "29      1.090\n",
       "        ...  \n",
       "3457    0.000\n",
       "3458   -0.334\n",
       "3459    0.000\n",
       "3460   -2.094\n",
       "3461   -0.579\n",
       "3462   -2.408\n",
       "3463   -2.244\n",
       "3464    0.862\n",
       "3465   -0.926\n",
       "3466   -1.141\n",
       "3467   -1.535\n",
       "3468   -4.762\n",
       "3469    1.089\n",
       "3470   -2.813\n",
       "3471    2.628\n",
       "3472    0.000\n",
       "3473    5.011\n",
       "3474   -2.474\n",
       "3475   -1.004\n",
       "3476   -0.773\n",
       "3477    0.228\n",
       "3478   -1.667\n",
       "3479    0.000\n",
       "3480    1.080\n",
       "3481    0.000\n",
       "3482   -2.874\n",
       "3483    0.000\n",
       "3484   -5.108\n",
       "3485    1.111\n",
       "3486   -0.478\n",
       "Name: changepercent, Length: 3487, dtype: float64"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['changepercent']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-1.261"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['changepercent'].median()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>code</th>\n",
       "      <th>name</th>\n",
       "      <th>changepercent</th>\n",
       "      <th>trade</th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>settlement</th>\n",
       "      <th>volume</th>\n",
       "      <th>turnoverratio</th>\n",
       "      <th>amount</th>\n",
       "      <th>per</th>\n",
       "      <th>pb</th>\n",
       "      <th>mktcap</th>\n",
       "      <th>nmc</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "Empty DataFrame\n",
       "Columns: [code, name, changepercent, trade, open, high, low, settlement, volume, turnoverratio, amount, per, pb, mktcap, nmc]\n",
       "Index: []"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import numpy as np\n",
    "df[df['changepercent']==np.nan]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
